package ambika.collections;
import java.util.HashMap;


import java.util.Set;


public class Map {

	class Student{
		private String name;

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}
		
		public String toString(){
			String var = "This student's name is "+name;
			return var;
		}
		
	}
	
	
	public void exampleMap(){
		
		HashMap<String, Student> sMap = new HashMap<String, Student>();
		
		
		sMap.put("Ambika", new Student());
		
		
		
		System.out.println("The value for the name in the student object is " + ((java.util.Map<String, Student>) sMap).get("Hari"));
		Set<String> keys = ((java.util.Map<String, Student>) sMap).keySet();
		
		
		//keys.iterator(); this is one way of accessing map data
		
		for (String key : keys) {
			
			System.out.println("Key is :" + key + "  Value is : " + ((java.util.Map<String, Student>) sMap).get(key));
		}
		
	}	
	
}
